package com.it.plic;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author げっしょく
 * @date 2021/8/8
 */
public class Demo5_1 {
    public static void main(String[] args) throws IOException {
        ServerSocket s = new ServerSocket(10000);
        Socket accept = s.accept();
        InputStream ips = accept.getInputStream();
        int i;
        byte[] b = new byte[4];
        while ((i = ips.read(b)) != -1) {
            System.out.println(new String(b, 0, i));
        }
        OutputStream ops = accept.getOutputStream();
        ops.write("你谁啊".getBytes());
        ops.flush();
        ops.close();
        s.close();
    }
}
